<!DOCTYPE html>
<html class="loginHtml">
<head>
	<meta charset="utf-8">
	<title>登录--layui后台管理模板 2.0</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="icon" href="/favicon.ico">
	<link rel="stylesheet" href="{{ asset('/plus/layui-v2.4.5/css/layui.css') }}" media="all" />
	<link rel="stylesheet" href="{{ asset('/admin/css/public.css') }}" media="all" />
</head>
<body class="loginBody">
	<form class="layui-form" name="mainform" method="post">
		<div class="login_face"><img src="{{ asset('/admin/images/face.jpg') }}" class="userAvatar"></div>
		<div class="layui-form-item input-item">
			<label for="userName">用户名</label>
			<input type="text" name="username" placeholder="请输入用户名" value="admin" autocomplete="off" id="userName" class="layui-input" lay-verify="required">
		</div>
		<div class="layui-form-item input-item">
			<label for="password">密码</label>
			<input name="password" type="password" placeholder="请输入密码" value="admin" autocomplete="off" id="password" class="layui-input" lay-verify="required">
		</div>
				<div class="layui-form-item">
			<label class="layui-form-label" style="width:50px;left:0px;">记住我</label>
			<div class="layui-input-block" style="margin-left: 70px;">
				<select name="remember" lay-verify="required">
					<option value="">不用</option>
					<option value="3">三天</option>
					<option value="7">七天</option>
					<option value="15" selected>十五天</option>
				</select>
			</div>
		</div>
		{{ csrf_field() }}
		<div class="layui-form-item" style="margin-top:20px;">
			<a href="javascript:;" onclick="fun1()" class="layui-btn layui-block">登录</a>
		</div>
	</form>
	<script type="text/javascript" src="{{ asset('/plus/layui-v2.4.5/layui.js') }}"></script>
	<script type="text/javascript" src="{{ asset('/admin/js/login.js') }}"></script>
	<script type="text/javascript" src="{{ asset('/admin/js/cache.js') }}"></script>
</body>
</html>
<script>
function fun1()
{
	var f = document.mainform;
	if(f.username.value=='') {
		layer.msg("请输入用户名");
		return;
	}
	if(f.password.value=='') {
		layer.msg("请输入密码");
		return;
	}
	$.ajax({
		type: 'POST',
		url:"{{url('/admin/login/in')}}",
		data: $("[name='mainform']").serialize(),
        dataType:"json",
        success:function(re)
        {
            if (re.code == "1") {
                layer.msg(re.msg, {icon: 1});
                setTimeout("window.location.href='/admin/index'",1000);
            } else if(re.code == "2") {
                layer.msg(re.msg, {icon: 2});
                // setTimeout("window.location.reload()",2000);
            }
        }
	})
}
</script>
